var express = require("express");
var router = express.Router();

/* GET home page. */
router.get("/list", function (req, res, next) {
  // 连接数据库
  const data = [
    {
      name: "hongbing",
      id: 1,
      age: 20,
    },
    {
      name: "xinzhi",
      id: 2,
      age: 30,
    },
  ];
  res.json({
    status: 0,
    result: data,
  });
});

router.post("/add", (req, res, next) => {
  console.log(req.body);
  res.json({
    status: 0,
    msg: "新增成功",
  });
});

module.exports = router;
